package com.startup.yellocar.dto;

import java.io.Serializable;

import javax.persistence.Cacheable;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;

@SuppressWarnings("serial")
@Entity
@Table(name = "preference")
@Cacheable
@Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class PreferenceDTO implements Serializable{
	
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Integer id;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "iduser")
	private UserDTO user;
	@ManyToOne(fetch = FetchType.EAGER)
	@JoinColumn(name = "idlanguage")
	private LanguageDTO language;
	@Column(name="paymentmode") 
	@Enumerated(EnumType.STRING)
	private PaymentModeEnum paymentMode;
	//getters & setters
	
	public PreferenceDTO() {
		super();
	}
	public PreferenceDTO(PaymentModeEnum paymentMode) {
		super();
		this.paymentMode = paymentMode;
	}
	public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}

	
	public UserDTO getUser() {
		return user;
	}
	public void setUser(UserDTO user) {
		this.user = user;
	}
	public LanguageDTO getLanguage() {
		return language;
	}
	public void setLanguage(LanguageDTO language) {
		this.language = language;
	}
	public PaymentModeEnum getPaymentMode() {
		return paymentMode;
	}
	public void setPaymentMode(PaymentModeEnum paymentMode) {
		this.paymentMode = paymentMode;
	}
	

}
